package com.xinrui.sunnyday.serivce.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.xinrui.sunnyday.dao.UserDao;
import com.xinrui.sunnyday.pojo.Menu;
import com.xinrui.sunnyday.pojo.User;
import com.xinrui.sunnyday.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service(interfaceClass = UserService.class)
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;

    /**
     * 多表联查:查询当前用户的角色和权限
     *
     * @param username
     * @return
     */
    @Override
    public User findByName(String username) {
        return userDao.findByName(username);
    }

    /**
     * 根据角色id查询菜单
     * @param id
     * @return
     */
    @Override
    public List<Menu> findByMenuId(Integer id) {
        return userDao.findByMenuId(id);
    }
}
